package kr.hkit.PowerJava.chapter06;

public class GuguDanwhile {
       public static void main(String[] args) {
	/*	  System.out.printf("%2d * %2d= %2d %n",2,1,2*1);
		  System.out.printf("%2d * %2d= %2d %n",2,2,2*2);
		  System.out.printf("%2d * %2d= %2d %n",2,3,2*3);
		  System.out.printf("%2d * %2d= %2d %n",2,4,2*4);
		  System.out.printf("%2d * %2d= %2d %n",2,5,2*5);
		  System.out.printf("%2d * %2d= %2d %n",2,6,2*6);
		  System.out.printf("%2d * %2d= %2d %n",2,7,2*7);
		  System.out.printf("%2d * %2d= %2d %n",2,8,2*8);
		  System.out.printf("%2d * %2d= %2d %n",2,9,2*9);
         */
	//	  calGuguDan();
    	  infiniteLoop();
    	   //  calReverseGuguDan();      
	}

	private static void infiniteLoop() {
		int i =0;
		while(true){
			System.out.println("*****");
		    if (i==5)break;
		    i++;
		//무한반복
		}
		
	}

	private static void calGuguDan(int dan) {
		int i=1;
		System.out.println("==== "  +  dan  +  " ====");
		while(i<10){
			System.out.printf("%2d *%2d = %2d %n",dan, i, dan*i);
		i++;
		
		}
		
	}
    
	private static void calGuguDan() {
		int dan=2;
		
		while(dan<10){
			int i=1;
			while(i<10){
			System.out.printf("%2d * %2d= %2d %n",dan,i,dan*i);
			i=i+1;	
			}
	       dan++;
		} 
		}
		private static void calReverseGuguDan() {
		int i=9;
		while(i>0){
		  System.out.printf("%2d *%2d = %2d %n",2, i, 2*i);
		  i--;
		  
		}
	}

	
}
